import request from '@/utils/request'

/**
 * 获取路由列表
 */
export function listRoutes() {
  let menu=[
    {
      "path": "/system",
      "component": "Layout",
      "alwaysShow": true,
      "name": "1",
      "hidden": false,
      "meta": {
        "title": "系统管理",
        "icon": "table",
        "roles": [
          "ADMIN",
          "abc001",
          "4555444",
          "pt",
          "GUEST"
        ]
      },
      "children": [
        {
          "path": "user",
          "component": "system/user/index",
          "alwaysShow": false,
          "name": "2",
          "hidden": false,
          "meta": {
            "title": "用户管理",
            "icon": "user",
            "roles": [
              "abc001",
              "ADMIN",
              "4555444",
              "pt",
              "GUEST"
            ]
          }
        },
        {
          "path": "role",
          "component": "system/role/index",
          "alwaysShow": false,
          "name": "3",
          "hidden": false,
          "meta": {
            "title": "角色管理",
            "icon": "peoples",
            "roles": [
              "abc001",
              "GUEST",
              "pt",
              "4555444",
              "ADMIN"
            ]
          }
        },
        {
          "path": "menu",
          "component": "system/menu/index",
          "alwaysShow": false,
          "name": "4",
          "hidden": false,
          "meta": {
            "title": "菜单管理",
            "icon": "tree-table",
            "roles": [
              "4555444",
              "abc001",
              "ADMIN",
              "pt"
            ]
          }
        },
        {
          "path": "dept",
          "component": "system/dept/index",
          "alwaysShow": false,
          "name": "5",
          "hidden": false,
          "meta": {
            "title": "部门管理",
            "icon": "tree",
            "roles": [
              "ADMIN",
              "4555444",
              "pt",
              "abc001"
            ]
          }
        },
        {
          "path": "dict",
          "component": "system/dict/index",
          "alwaysShow": false,
          "name": "6",
          "hidden": false,
          "meta": {
            "title": "字典管理",
            "icon": "education",
            "roles": [
              "ADMIN",
              "4555444",
              "pt",
              "abc001"
            ]
          }
        },
        {
          "path": "client",
          "component": "system/client/index",
          "alwaysShow": false,
          "name": "7",
          "hidden": false,
          "meta": {
            "title": "客户端管理",
            "icon": "tab",
            "roles": [
              "4555444",
              "pt",
              "ADMIN",
              "abc001"
            ]
          }
        }
      ]
    },
    {
      "path": "/pms",
      "component": "Layout",
      "alwaysShow": true,
      "name": "11",
      "hidden": false,
      "meta": {
        "title": "商品管理",
        "icon": "phone",
        "roles": [
          "4555444",
          "ADMIN",
          "abc002"
        ]
      },
      "children": [
        {
          "path": "goods",
          "component": "pms/goods/index",
          "alwaysShow": false,
          "name": "12",
          "hidden": false,
          "meta": {
            "title": "商品列表",
            "icon": "component",
            "roles": [
              "abc002",
              "ADMIN",
              "4555444"
            ]
          }
        },
        {
          "path": "goods-detail",
          "component": "pms/goods/detail",
          "alwaysShow": false,
          "name": "19",
          "hidden": false,
          "meta": {
            "title": "商品上架",
            "icon": "component",
            "roles": [
              "abc002",
              "ADMIN",
              "4555444"
            ]
          }
        },
        {
          "path": "category",
          "component": "pms/category/index",
          "alwaysShow": false,
          "name": "18",
          "hidden": false,
          "meta": {
            "title": "商品分类",
            "icon": "component",
            "roles": [
              "ADMIN",
              "abc002",
              "4555444"
            ]
          }
        },
        {
          "path": "brand",
          "component": "pms/brand/index",
          "alwaysShow": false,
          "name": "17",
          "hidden": false,
          "meta": {
            "title": "品牌管理",
            "icon": "component",
            "roles": [
              "4555444",
              "ADMIN",
              "abc002"
            ]
          }
        }
      ]
    },
    {
      "path": "/oms",
      "component": "Layout",
      "alwaysShow": true,
      "name": "13",
      "hidden": false,
      "meta": {
        "title": "订单管理",
        "icon": "shopping",
        "roles": [
          "4555444",
          "ADMIN"
        ]
      },
      "children": [
        {
          "path": "order",
          "component": "oms/order/index",
          "alwaysShow": false,
          "name": "14",
          "hidden": false,
          "meta": {
            "title": "订单列表",
            "icon": "component",
            "roles": [
              "ADMIN",
              "4555444"
            ]
          }
        }
      ]
    },
    {
      "path": "/ums",
      "component": "Layout",
      "alwaysShow": true,
      "name": "15",
      "hidden": false,
      "meta": {
        "title": "会员管理",
        "icon": "user",
        "roles": [
          "4555444",
          "ADMIN"
        ]
      },
      "children": [
        {
          "path": "user",
          "component": "ums/member/index",
          "alwaysShow": false,
          "name": "16",
          "hidden": false,
          "meta": {
            "title": "会员列表",
            "icon": "peoples",
            "roles": [
              "ADMIN",
              "4555444"
            ]
          }
        }
      ]
    },
    {
      "path": "/sms",
      "component": "Layout",
      "alwaysShow": true,
      "name": "9",
      "hidden": false,
      "meta": {
        "title": "营销管理",
        "icon": "number",
        "roles": [
          "ADMIN",
          "GUEST",
          "4555444"
        ]
      },
      "children": [
        {
          "path": "advert",
          "component": "sms/advert/index",
          "alwaysShow": false,
          "name": "10",
          "hidden": false,
          "meta": {
            "title": "广告管理",
            "icon": "documentation",
            "roles": [
              "ADMIN",
              "GUEST",
              "4555444"
            ]
          }
        }
      ]
    }
  ]

  return menu
  
    return request({
        url: '/youlai-admin/api/v2/menus/route',
        method: 'get'
    })
}

/**
 * 获取(表格)菜单列表
 *
 * @param queryParams
 */
export function listTableMenus(queryParams: object) {
    return request({
        url: '/youlai-admin/api/v1/menus/table',
        method: 'get',
        params: queryParams
    })
}

/**
 * 获取(下拉)菜单列表
 */
export function listSelectMenus() {
    return request({
        url: '/youlai-admin/api/v1/menus/select',
        method: 'get'
    })
}

/**
 * 获取(树形下拉)菜单列表
 */
export function listTreeSelectMenus() {
    return request({
        url: '/youlai-admin/api/v1/menus/tree_select',
        method: 'get'
    })
}


/**
 * 获取菜单详情
 * @param id
 */
export function getMenuDetail(id: number) {
    return request({
        url: '/youlai-admin/api/v1/menus/' + id,
        method: 'get'
    })
}

/**
 * 添加菜单
 *
 * @param data
 */
export function addMenu(data: object) {
    return request({
        url: '/youlai-admin/api/v1/menus',
        method: 'post',
        data: data
    })
}

/**
 * 修改菜单
 *
 * @param id
 * @param data
 */
export function updateMenu(id: number, data: object) {
    return request({
        url: '/youlai-admin/api/v1/menus/' + id,
        method: 'put',
        data: data
    })
}

/**
 * 批量删除菜单
 *
 * @param ids 菜单ID，多个以英文逗号(,)分割
 */
export function deleteMenus(ids: string) {
    return request({
        url: '/youlai-admin/api/v1/menus/' + ids,
        method: 'delete'
    })
}
